<%-- 
    Document   : minhas_receitas
    Created on : 31/08/2014, 16:48:36
    Author     : aluno
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<jsp:useBean id="user" class="Model.Usuario" scope="session"/>
<jsp:useBean id="myrecs" class="java.util.ArrayList" scope="session"/>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="css/css.css">
        <title>Minhas Receitas</title>
    </head>
    <body>
        <a href="ServletUsuario?opt=detalhes">Home</a>
        <c:if test="${user != null}">
            <h1> Minhas Receitas</h1>
            <table border="2px">
                <tr><td>Categoria</td>
                    <td>Nome da receita</td>
                    <td>Média de Notas</td>
                </tr>
                <c:if test="${myrecs.size() > 0}" >
                    <c:forEach var="receita" items="${myrecs}">  
                        <tr>
                            <td>${receita.getCategoria()}</td>
                            <td>${receita.getName()}</td>
                            <td>${receita.getAvg()}</td>
                            <td><a href="ServletReceita?opt=detalhe&id=${receita.getId()}">Detalhes</a></td>
                        </tr>
                    </c:forEach>
                </c:if>
            </table>

            <h1>Mais curtidas</h1>
            <table border="1">
                <tr>
                    <td>Categoria</td>
                    <td>Nome da receita</td>
                    <td>Média de Notas</td>
                </tr>
                <jsp:useBean id="like" class="java.util.ArrayList" scope="session"/>
                <c:if test="${like.size() > 0 }">
                    <c:forEach var="li" items="${like}">
                        <tr><td>${li.getCategoria()}</td>
                            <td>${li.getName()}</td>
                            <td>${li.getAvg()}</td>
                        </tr>
                    </c:forEach>
                </c:if>

            </table>
        </c:if>
        <br><a href="ServletUsuario?opt=detalhes" style="margin-left: 300px;">Voltar</a>   
    </body>
</html>
